package com.dawn.module.cms.dal.mysql.doctor;

import java.util.*;

import com.dawn.framework.common.pojo.PageResult;
import com.dawn.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.dawn.framework.mybatis.core.mapper.BaseMapperX;
import com.dawn.module.cms.dal.dataobject.department.DepartmentDO;
import com.dawn.module.cms.dal.dataobject.doctor.DoctorDO;
import org.apache.ibatis.annotations.Mapper;
import com.dawn.module.cms.controller.admin.doctor.vo.*;

/**
 * 医生信息 Mapper
 *
 * @author root
 */
@Mapper
public interface DoctorMapper extends BaseMapperX<DoctorDO> {

    default PageResult<DoctorDO> selectPage(DoctorPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<DoctorDO>()
                .likeIfPresent(DoctorDO::getName, reqVO.getName())
                .likeIfPresent(DoctorDO::getNickname, reqVO.getNickname())
                .eqIfPresent(DoctorDO::getGender, reqVO.getGender())
                .eqIfPresent(DoctorDO::getBirthday, reqVO.getBirthday())
                .eqIfPresent(DoctorDO::getHeadImageUrl, reqVO.getHeadImageUrl())
                .eqIfPresent(DoctorDO::getPhone, reqVO.getPhone())
                .eqIfPresent(DoctorDO::getJobTitle, reqVO.getJobTitle())
                .eqIfPresent(DoctorDO::getSpecialist, reqVO.getSpecialist())
                .eqIfPresent(DoctorDO::getWorkRange, reqVO.getWorkRange())
                .eqIfPresent(DoctorDO::getTags, reqVO.getTags())
                .eqIfPresent(DoctorDO::getAddress, reqVO.getAddress())
                .likeIfPresent(DoctorDO::getOrgName, reqVO.getOrgName())
                .eqIfPresent(DoctorDO::getDepartmentId, reqVO.getDepartmentId())
                .likeIfPresent(DoctorDO::getDepartmentName, reqVO.getDepartmentName())
                .eqIfPresent(DoctorDO::getHisDeptCode, reqVO.getHisDeptCode())
                .likeIfPresent(DoctorDO::getHisDeptName, reqVO.getHisDeptName())
                .eqIfPresent(DoctorDO::getHisDoctorCode, reqVO.getHisDoctorCode())
                .likeIfPresent(DoctorDO::getHisDoctorName, reqVO.getHisDoctorName())
                .eqIfPresent(DoctorDO::getLinkUrl, reqVO.getLinkUrl())
                .eqIfPresent(DoctorDO::getTips, reqVO.getTips())
                .eqIfPresent(DoctorDO::getNotice, reqVO.getNotice())
                .eqIfPresent(DoctorDO::getDescription, reqVO.getDescription())
                .eqIfPresent(DoctorDO::getContent, reqVO.getContent())
                .eqIfPresent(DoctorDO::getContentFormat, reqVO.getContentFormat())
                .eqIfPresent(DoctorDO::getRemark, reqVO.getRemark())
                .eqIfPresent(DoctorDO::getPictures, reqVO.getPictures())
                .eqIfPresent(DoctorDO::getFiles, reqVO.getFiles())
                .eqIfPresent(DoctorDO::getViews, reqVO.getViews())
                .eqIfPresent(DoctorDO::getTopping, reqVO.getTopping())
                .eqIfPresent(DoctorDO::getRecommend, reqVO.getRecommend())
                .betweenIfPresent(DoctorDO::getPublishTime, reqVO.getPublishTime())
                .eqIfPresent(DoctorDO::getPublish, reqVO.getPublish())
                .eqIfPresent(DoctorDO::getSort, reqVO.getSort())
                .eqIfPresent(DoctorDO::getStatus, reqVO.getStatus())
                .betweenIfPresent(DoctorDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(DoctorDO::getSort).orderByDesc(DoctorDO::getUpdateTime).orderByDesc(DoctorDO::getId));
    }

}